package net.sh.dpinfrastructure.sql;


/**
 * 
 * sql拼接类
 * 
 * @version 1.0
 * @since JDK1.7
 * @author shaohui
 * @company 上海朝阳永续信息技术有限公司
 * @copyright (c) 2015 SunTime Co'Ltd Inc. All rights reserved.
 * @date 2015年10月19日 下午3:26:59
 */
public class DPSqlAppender {
    
    private StringBuilder sqlBuilder;
    
    public DPSqlAppender() {
        sqlBuilder = new StringBuilder();
    }
    
    public DPSqlAppender(String sql) {
        sqlBuilder = new StringBuilder(sql);
    }
    
    public DPSqlAppender append(String sql) {
        sqlBuilder.append(" ").append(sql).append(" ");
        return this;
    }
    
    public DPSqlAppender append(int sql) {
        return append(Integer.toString(sql));
    }
    
    public DPSqlAppender append(long sql) {
        return append(Long.toString(sql));
    }
    
    public DPSqlAppender append(float sql) {
        return append(Float.toString(sql));
    }
    
    public DPSqlAppender append(double sql) {
        return append(Double.toString(sql));
    }
    
    public DPSqlAppender append(boolean sql) {
        return append(Boolean.toString(sql));
    }
    
    public DPSqlAppender append(char sql) {
        return append(Character.toString(sql));
    }
    
    public DPSqlAppender append(Object sql) {
        return append(sql.toString());
    }
    
    
    public DPSqlAppender eq(String field, Object value) {
        return this;
    }
    
    
    @Override
    public String toString() {
        return sqlBuilder.toString();
    }
}
